<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script src="../dev/vendors/vue.js"></script>
  <div id="app">
    <p>Message is: {{ message }}</p>
    <input v-model.trim="message" placeholder="edit me">
    <p>Message is: {{ message2 }}</p>
    <input v-on:input="input($event)" placeholder="edit me">

    <span>Multiline message is:</span>
    <p style="white-space: pre">{{ message }}</p>
    <br>
    <textarea v-model="message" placeholder="add multiple lines">123</textarea>

    <input type="checkbox" id="checkbox" v-model="checked">
    <label for="checkbox">{{ checked }}</label>

    <br>
    checkbox
    <input type="checkbox" id="jack" value="Jack" v-model="checkedNames">
    <label for="jack">Jack</label>
    <input type="checkbox" id="john" value="John" v-model="checkedNames">
    <label for="john">John</label>
    <input type="checkbox" id="mike" value="Mike" v-model="checkedNames">
    <label for="mike">Mike</label>
    <br>
    <span>Checked names: {{ checkedNames }}</span>

    <br>
    example-4
    <div id="example-4" class="demo">
      <input type="radio" id="one" value="One" v-model="picked">
      <label for="one">One</label>
      <br>
      <input type="radio" id="two" value="Two" v-model="picked">
      <label for="two">Two</label>
      <input type="radio" id="three" value="Three" v-model="picked">
      <label for="three">Three</label>
      <br>
      <span>Picked: {{ picked }}</span>
    </div>

    <br>
    <div id="example-5" class="demo">
      <select v-model="selected">
        <option>A</option>
        <option>B</option>
        <option>C</option>
      </select>
      <span>Selected: {{ selected }}</span>
    </div>

    <br>
    <div id="example-6" class="demo">
      <select v-model="multiple" multiple style="width: 50px">
        <option value="apple">A</option>
        <option value="banana">B</option>
        <option value="car">C</option>
      </select>
      <br>
      <span>Selected: {{ multiple }}</span>
    </div>

    <br>
    <select v-model="selected">
      <option v-for="option in options" v-bind:value="option.value">
        {{ option.text }}
      </option>
    </select>
    <span>Selected: {{ selected }}</span>

    <br>
    toggle
    <input type="checkbox" v-model="toggle">
    {{ toggle }}

    <br>
    <input
      type="checkbox"
      v-model="toggle"
      v-bind:true-value="a"
      v-bind:false-value="b"
    >

    <br>
    内联对象字面量
    <select v-model="selected2">
        <!-- 内联对象字面量 -->
      <option v-bind:value="{ number: 123 }">123</option>
    </select>

  </div>
  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        message: null,
        message2: '',
        checked: true,
        checkedNames: [],
        picked: 'Two',
        selected: 'B',
        selected2: '',
        multiple: [],
        options: [
          { text: 'One', value: 'A' },
          { text: 'Two', value: 'B' },
          { text: 'Three', value: 'C' }
        ],
        toggle: '',
        a: 'AAA',
        b: 'BBB'
      },
      methods: {
        input: function (e) {
          this.message2 = e.target.value
        }
      }
    })
  </script>
</body>
</html>